Through a grid's Columns collection, all the columns in a grid, regardless of their visibility, can be accessed. To access only the visible columns—those whose Visible property is set to true—the VisibleColumns property can be consulted. The value of a column's Index property represents its position within the Columns collection while the visible position of a column can be retrieved through a column's VisiblePosition property, which may or may not correspond to the Index property. In addition to the VisiblePosition property, the IsFirstVisible and IsLastVisible properties can be used to determine if a column is the first or last visible column in a grid. A column-manager row's AllowColumnReorder property can prevent end users from changing the visible positions of columns; however, programmatic changes to a column's visible position can still be made.
At runtime, data items can be grouped using a GroupByControl or HierarchicalGroupByControl, which provide a condensed view of the group levels and allow end users to modify the group descriptions applied to a grid and details (see Figure 1 and 2 in Grouping Data). Each group level is represented by a GroupByItem or HierarchicalGroupByItem, which can be used to change the order of the groups, sort the data items, or remove the groups. A ColumnManagerRow can also be used to group and sort the data items (see Figure 3 and 4 in Grouping Data).
End-user interaction can be limited through the column-manager row's AllowSort property, which prevents columns from being sorted; the AllowGroupingModification property, which prevents groups from being added or removed; and the AllowColumnReorder property, which prevents columns from being reordered. These properties only affect end-user interaction and do not prevent programmatic changes.
An "unbound column" is a column that can be used to display non-data related information such as a label or controls that allow some sort of action to be carried out (e.g., a button to open a window in which the current item can be edited). Unlike data bound columns, unbound columns cannot be grouped or sorted, and their values cannot be filtered.
When adding unbound columns, it often becomes necessary to access the parent cell or row from the element specified as the cell content template. The static FindFromChild method, which is defined on the Cell class, allows the parent cell to be retrieved by specifying the element (usually the sender in the event arguments) used as the template. From the cell returned by the FindFromChild method, the parent row can be retrieved through the cell's ParentRow property. If the parent data item is required, the parent row can be provided to the grid's GetItemFromContainer method, which will return the parent data item (see Example 1).
The content of each cell in a column—assuming that the column or its cells are not read-only—can be edited at runtime by the end user through the use of cell editors. Cell editors are created from DataTemplates (see Templates) and are used to edit the content of cells. Custom cell editors can be provided per column by setting a column's CellEditor property, or per data type through the DataGridControl's DefaultCellEditors property (see Cell Editors). A column's CellEditorDisplayConditions property can be set to override the display conditions determined by the parent grid.
When a column's CanBeCurrentWhenReadOnly property is false and its ReadOnly property is true, its cells cannot receive focus: clicking on these cells has no effect, and using the keyboard (arrow keys, Tab key, etc.) causes the focus rectangle to skip the cells. Furthermore, the cell's EditTemplate is not displayed. The value of this property is ignored if ReadOnly is set to false.
For more information on editing a validating data, refer to the Editing Data topic.
In addition to the built-in container recycling, which applies to all views, the TableView class provides column virtualization, meaning that columns and cells that are not visible in the viewport are not created until they are brought into the viewport or accessed. If required, column virtualization can be disabled by setting the IsColumnVirtualizationEnabled property to false (by default, true).
The GroupValueTemplate and GroupValueTemplateSelector properties determine how the value of a group (e.g., "Canada", "France") is displayed, while the GroupConfiguration property determines the configuration of the same-level groups when the data items are grouped according to the values of the column.
A column's Title property represents the data that, by default, is displayed in a column's corresponding column-manager cell and/or group-by item. If the Title property has not been explicitly set, the value of the FieldName property will be used. The DataTemplate used to display a column's title can be modified through the TitleTemplate property while the TitleTemplateSelector property can be used to provide different title templates based on custom criteria (see Templates).
Back to Cell Class | Go to Row Class